import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:get/get.dart';
import 'package:travel/model/theme.dart';
import 'package:travel/model/tourism.dart';
import 'package:travel/routes/index.dart';
import 'package:travel/screen/flutter_screenutil.dart';
import 'package:travel/ui/max_line_wrap.dart';
import 'package:travel/utils/colors.dart';
import 'package:travel/utils/radian.dart';
import 'package:travel/utils/styles.dart';
import 'package:travel/utils/tools.dart';

class AttractionsController extends GetxController {
  late Rx<ThemeTourismModel> model;
  RxList<TourismModel> data = RxList([]);

  GlobalKey goKey = GlobalKey();

  ScrollController scrollController = ScrollController();

  RxList<String> tags = RxList(
      ['景色优美 259', '联票划算 5', '值得再来 12', '建筑有特殊 10', '拍照很赞 10', '公共交通方便 10']);

  @override
  void onInit() {
    super.onInit();
    model = Rx(ThemeTourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/u700.png',
        name: '故宫博物馆',
        level: 5,
        point: 4.8,
        evaluate: 3358,
        distance: 1.5,
        price: 50));
    if (Get.arguments != null) {
      model = Rx(Get.arguments['model']);
    }
    initData();
  }

  void initData() {
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p63.png',
        describe: '去故宫，一定要做的十件事，你知道几个？',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p64.png',
        browse: 1.9,
        nickname: '小李在沈阳'));
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p69.png',
        describe: '别再瞎逛故宫了，去过100次的土著攻略',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/首页_未登录/p10.png',
        browse: 1.3,
        nickname: '小沈阳10'));
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p65.png',
        describe: '北京故宫的必游攻略！感受故宫文化的深厚美',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/首页_未登录/p3.png',
        browse: 2.1,
        nickname: '美腻的猫',
        video: true));
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p71.png',
        describe: '故宫必须知道的几件事攻略',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/首页_未登录/p10.png',
        browse: 1.1,
        nickname: '晚风心里吹'));
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p67.png',
        describe: '北京郊区大自然山景私汤山酒店',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/首页_未登录/p5.png',
        browse: 1.1,
        nickname: '美美在旅行'));
    data.add(TourismModel(
        imgUrl:
            'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/p73.png',
        describe: '人少景美“京西小故宫”修缮五年后惊艳开放',
        avatar:
            'https://cdn7.axureshop.com/demo2023/2251242/images/首页_未登录/p12.png',
        browse: 1.7,
        nickname: '美美在旅行',
        video: true));
  }
}

class AttractionsView extends GetView<AttractionsController> {
  const AttractionsView({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(() => Scaffold(
          backgroundColor: ColorsUtils.backgroundColor,
          body: content(context),
          bottomNavigationBar: Container(
              height: 77.w,
              decoration: const BoxDecoration(color: Colors.white),
              padding: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.w),
              alignment: Alignment.topLeft,
              child: Container(
                height: 40.w,
                alignment: Alignment.centerLeft,
                child: Row(
                  children: [
                    Container(
                        width: 165.w,
                        height: 40.w,
                        decoration: BoxDecoration(
                            color: ColorsUtils.parseColorFromHexString(
                                ColorsUtils.colorF5f5),
                            borderRadius: BorderRadius.circular(20.w)),
                        padding: EdgeInsets.symmetric(horizontal: 20.w),
                        alignment: Alignment.centerLeft,
                        child: TextButton(
                          onPressed: () {
                            Get.toNamed(RoutePath.comment);
                          },
                          child: Text.rich(TextSpan(children: [
                            WidgetSpan(
                                child: ToolsUtils.assetImageSvg('u775.svg',
                                    width: 15, height: 15.h),
                                alignment: PlaceholderAlignment.middle),
                            TextSpan(
                                text: '写评论…',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color9999,
                                    fontSize: 13.sp))
                          ])),
                        )),
                    Expanded(
                        child: SizedBox(
                      height: 40.w,
                      child: Column(
                        children: [
                          Container(
                            alignment: Alignment.center,
                            child: ToolsUtils.assetImageSvg('u771.svg',
                                width: 22.w, height: 20.h),
                          ),
                          Container(
                            alignment: Alignment.center,
                            margin: EdgeInsets.only(top: 5.w),
                            child: Text(
                              '已收藏',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color3333,
                                  fontSize: 12.sp),
                            ),
                          )
                        ],
                      ),
                    )),
                    InkWell(
                        onTap: () {
                          final keyRenderObject = controller
                              .goKey.currentContext
                              ?.findAncestorRenderObjectOfType();
                          controller.scrollController.position.ensureVisible(
                              keyRenderObject!,
                              duration: const Duration(milliseconds: 200),
                              curve: Curves.linear);

                          // Offset globalToLocal =
                          //     (controller.goKey.currentContext!.findRenderObject() as RenderBox)
                          //         .localToGlobal(Offset.zero);
                          // controller.scrollController.animateTo(globalToLocal.dy,
                          //     duration: const Duration(milliseconds: 200), curve: Curves.linear);
                        },
                        child: Container(
                          width: 110.w,
                          height: 40.w,
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(8.w),
                              gradient: LinearGradient(
                                  colors: [
                                    ColorsUtils.rgba(52, 120, 246, 1),
                                    ColorsUtils.rgba(2, 167, 240, 1)
                                  ],
                                  stops: const <double>[
                                    0,
                                    0.99
                                  ],
                                  transform: GradientRotation(
                                      RadianUtils.angleToRadian(90)))),
                          alignment: Alignment.center,
                          child: Text.rich(TextSpan(children: [
                            WidgetSpan(
                                child: ToolsUtils.assetImageSvg('u774.svg',
                                    width: 20.w, height: 20.h),
                                alignment: PlaceholderAlignment.middle),
                            TextSpan(
                                text: ' 前往预定',
                                style: StylesUtils.customTextStyle(
                                    fontSize: 15.sp))
                          ])),
                        ))
                  ],
                ),
              )),
        ));
  }

  Widget content(BuildContext context) {
    return CustomScrollView(
      controller: controller.scrollController,
      slivers: [
        SliverPersistentHeader(
          pinned: true,
          delegate: _SliverCustomHeaderDelegate(
              collapsedHeight: 40.h,
              expandedHeight: 250.h,
              paddingTop: Get.mediaQuery.padding.top,
              coverImgUrl:
                  'https://cdn7.axureshop.com/demo2023/2251242/images/景点主页/u700.png',
              title: controller.model.value.name,
              level: controller.model.value.level),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 15.w),
            decoration: const BoxDecoration(color: Colors.white),
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.only(top: 5.h),
                  child: Row(
                    children: [
                      Container(
                        height: 25.h,
                        width: 50.w,
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.only(
                                topLeft: Radius.circular(13.w),
                                bottomLeft: Radius.circular(13.w)),
                            gradient: LinearGradient(
                                colors: [
                                  ColorsUtils.rgba(52, 120, 246, 1),
                                  ColorsUtils.rgba(2, 167, 240, 1)
                                ],
                                stops: const [
                                  0,
                                  0.99
                                ],
                                transform: GradientRotation(
                                    RadianUtils.angleToRadian(90)))),
                        child: Text(
                          '${controller.model.value.point}分',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.colorFfff),
                        ),
                      ),
                      Container(
                        width: 95.w,
                        height: 25.h,
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                            color: ColorsUtils.parseColorFromHexString(
                                ColorsUtils.colorEbf6),
                            borderRadius: BorderRadius.only(
                                topRight: Radius.circular(13.w),
                                bottomRight: Radius.circular(13.w))),
                        child: Text(
                          '${controller.model.value.evaluate}条点评 ▸',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3478, fontSize: 12.sp),
                        ),
                      ),
                      Container(
                        width: 100.w,
                        height: 25.h,
                        margin: EdgeInsets.only(left: 10.w),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(13.w),
                          color: ColorsUtils.parseColorFromHexString(
                              ColorsUtils.colorEbf6),
                        ),
                        child: CustomPaint(
                          painter: _MyCustomPainter(),
                          child: Row(
                            children: [
                              Expanded(
                                  child: InkWell(
                                onTap: () {
                                  Get.toNamed(RoutePath.attractionsAlbum);
                                },
                                child: Center(
                                  child: Text(
                                    '相册',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.color3478),
                                  ),
                                ),
                              )),
                              Expanded(
                                  child: InkWell(
                                onTap: () {
                                  Get.toNamed(RoutePath.attractionsTravels,
                                      arguments: {
                                        'model': controller.model.value
                                      });
                                },
                                child: Center(
                                  child: Text('游记',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: 12.sp,
                                          color: ColorsUtils.color3478)),
                                ),
                              ))
                            ],
                          ),
                        ),
                      )
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
            decoration: const BoxDecoration(color: Colors.white),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Expanded(
                    child: Container(
                  margin: EdgeInsets.only(right: 5.w),
                  padding:
                      EdgeInsets.symmetric(vertical: 5.w, horizontal: 10.h),
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorEef9),
                      borderRadius: BorderRadius.circular(5.w)),
                  child: InkWell(
                    onTap: () {
                      Get.toNamed(RoutePath.attractionsIntroduce);
                    },
                    child: Stack(
                      children: [
                        Column(
                          children: [
                            Container(
                              height: 20.h,
                              alignment: Alignment.centerLeft,
                              child: Text(
                                '开园中',
                                style: StylesUtils.customTextStyle(
                                    fontSize: 13.sp,
                                    fontWeight: FontWeight.w700,
                                    color: ColorsUtils.color05b2),
                              ),
                            ),
                            Container(
                              height: 20.h,
                              alignment: Alignment.centerLeft,
                              child: Text(
                                '今日($weekDay)',
                                style: StylesUtils.customTextStyle(
                                    fontSize: 12.sp,
                                    color: ColorsUtils.color3333),
                              ),
                            ),
                            Container(
                              height: 20.h,
                              alignment: Alignment.centerLeft,
                              child: Text(
                                '08:30-16:30 开放',
                                style: StylesUtils.customTextStyle(
                                    fontSize: 12.sp,
                                    color: ColorsUtils.color3333),
                              ),
                            )
                          ],
                        ),
                        Positioned(
                            width: 12.w,
                            top: 0,
                            right: 0,
                            bottom: 0,
                            child: Center(
                              child: Icon(
                                Icons.arrow_forward_ios,
                                color: ColorsUtils.parseColorFromHexString(
                                    ColorsUtils.colorCccc),
                                size: 10.sp,
                              ),
                            )),
                        Positioned(
                          width: 26.w,
                          top: 0,
                          bottom: 0,
                          right: 12.w,
                          child: Center(
                            child: Text(
                              '景点详情',
                              style: StylesUtils.customTextStyle(
                                  fontSize: 12.sp,
                                  color: ColorsUtils.color6799),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                )),
                Expanded(
                    child: Container(
                  margin: EdgeInsets.only(left: 5.w),
                  padding:
                      EdgeInsets.symmetric(vertical: 5.w, horizontal: 10.h),
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorEef9),
                      borderRadius: BorderRadius.circular(5.w)),
                  child: Row(
                    children: [
                      Expanded(
                          child: Column(
                        children: [
                          Container(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '北京市东城区景山前街4号',
                              maxLines: 2,
                              overflow: TextOverflow.ellipsis,
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color3333,
                                  fontSize: 13.sp,
                                  lineHeight: 1.5.h),
                            ),
                          ),
                          Container(
                            alignment: Alignment.centerLeft,
                            margin: EdgeInsets.only(top: 5.w),
                            child: Text(
                              '距地铁1号线八通线距地铁1号线八通线',
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                              softWrap: true,
                              style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color9999,
                                fontSize: 12.sp,
                              ),
                            ),
                          )
                        ],
                      )),
                      InkWell(
                        onTap: () {
                          Get.toNamed(RoutePath.map);
                        },
                        child: Container(
                          width: 25.w,
                          alignment: Alignment.centerRight,
                          child: Text.rich(TextSpan(children: [
                            WidgetSpan(
                                alignment: PlaceholderAlignment.middle,
                                child: ToolsUtils.assetImageSvg('u722.svg',
                                    width: 18.w, height: 22.h)),
                            TextSpan(
                                text: '地图',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color3333,
                                    fontSize: 12.sp))
                          ])),
                        ),
                      )
                    ],
                  ),
                ))
              ],
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 15.w),
            decoration: const BoxDecoration(color: Colors.white),
            child: Container(
              height: 30.h,
              alignment: Alignment.centerLeft,
              decoration: BoxDecoration(
                  color: ColorsUtils.parseColorFromHexString(
                      ColorsUtils.colorFff1),
                  borderRadius: BorderRadius.circular(5.w)),
              padding: EdgeInsets.symmetric(horizontal: 10.w),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Expanded(
                      child: Container(
                    alignment: Alignment.centerLeft,
                    child: Wrap(
                      spacing: 4.w,
                      children: [
                        ToolsUtils.assetImageSvg('u796.svg',
                            width: 15.w, height: 15.h),
                        Text('公告：入园公告',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.colorFf00, fontSize: 12.sp))
                      ],
                    ),
                  )),
                  IconButton(
                      onPressed: () {
                        _showBasicModalBottomSheet(context);
                        // controller.panelController.open();
                      },
                      icon: Icon(
                        Icons.arrow_forward_ios_sharp,
                        color: ColorsUtils.parseColorFromHexString(
                            ColorsUtils.colorCccc),
                        size: 12.sp,
                      ))
                ],
              ),
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            alignment: Alignment.center,
            padding: EdgeInsets.symmetric(vertical: 10.h),
            decoration: const BoxDecoration(color: Colors.white),
            child: Divider(
              height: 1,
              color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorF5f5),
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.only(left: 10.w, right: 10.w, bottom: 15.h),
            decoration: const BoxDecoration(color: Colors.white),
            child: MaxLineWrap(
              itemAlignment: MaxLineWrapAlignment.start,
              spacing: 5.w,
              maxLine: 2,
              children: [
                Container(
                  width: 65.w,
                  height: 30.h,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF5f5),
                      borderRadius: BorderRadius.circular(15.h)),
                  child: Text(
                    '今日订',
                    style: StylesUtils.customTextStyle(
                        fontSize: 13.sp, color: ColorsUtils.color3333),
                  ),
                ),
                Container(
                  width: 65.w,
                  height: 30.h,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF5f5),
                      borderRadius: BorderRadius.circular(15.h),
                      border: Border.all(
                          color: ColorsUtils.parseColorFromHexString(
                              ColorsUtils.color6799))),
                  child: Text(
                    '明日订',
                    style: StylesUtils.customTextStyle(
                        fontSize: 13.sp, color: ColorsUtils.color6799),
                  ),
                ),
                Container(
                  width: 90.w,
                  height: 30.h,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF5f5),
                      borderRadius: BorderRadius.circular(15.h)),
                  child: Text(
                    '订11月12日',
                    style: StylesUtils.customTextStyle(
                        fontSize: 13.sp, color: ColorsUtils.color3333),
                  ),
                ),
                Container(
                  width: 90.w,
                  height: 30.h,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF5f5),
                      borderRadius: BorderRadius.circular(15.h)),
                  child: Text(
                    '更多日期＞',
                    style: StylesUtils.customTextStyle(
                        fontSize: 13.sp, color: ColorsUtils.color3333),
                  ),
                ),
              ],
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.all(15.w),
            decoration: BoxDecoration(
                color:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.colorF4F9)),
            child: Column(
              children: [
                Container(
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '门票',
                    style: StylesUtils.customTextStyle(
                        fontSize: 18.sp,
                        fontWeight: FontWeight.w700,
                        color: ColorsUtils.color3333),
                  ),
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.symmetric(vertical: 10.h),
                  child: Text(
                    '优待政策＞',
                    style: StylesUtils.customTextStyle(
                        color: ColorsUtils.colorFf99, fontSize: 12.sp),
                  ),
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(bottom: 20.h),
                  child: Text(
                    '累计销量5.1万+',
                    style: StylesUtils.customTextStyle(
                        fontSize: 12.sp, color: ColorsUtils.color9999),
                  ),
                ),
                Container(
                  key: controller.goKey,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.w),
                      boxShadow: [
                        BoxShadow(
                            color: ColorsUtils.rgba(
                                51, 51, 51, 0.0980392156862745),
                            offset: Offset.zero,
                            blurRadius: 5.w,
                            spreadRadius: 0,
                            blurStyle: BlurStyle.outer)
                      ]),
                  padding:
                      EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
                  margin: EdgeInsets.only(bottom: 15.h),
                  child: Stack(
                    children: [
                      Column(
                        children: [
                          Container(
                            height: 30.h,
                            alignment: Alignment.centerLeft,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Expanded(
                                    child: Text(
                                  '故宫门票(不含内馆)-成人票',
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 16.sp,
                                      color: ColorsUtils.color3333),
                                )),
                                Text.rich(TextSpan(children: [
                                  TextSpan(
                                      text: '￥',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorD900,
                                          fontSize: 13.sp)),
                                  TextSpan(
                                      text: '40',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.colorD900,
                                        fontSize: 24.sp,
                                      ))
                                ]))
                              ],
                            ),
                          ),
                          Container(
                              height: 25.h,
                              alignment: Alignment.centerLeft,
                              child: LayoutBuilder(builder:
                                  (BuildContext context,
                                      BoxConstraints constraints) {
                                double width = ToolsUtils.calculateTextHeight(
                                    context,
                                    '年龄18周岁（不含）~60周岁（不含）',
                                    FontWeight.normal,
                                    12.sp,
                                    200.w,
                                    1);
                                double max = ToolsUtils.min(
                                    width, constraints.maxWidth - 80.w);
                                return Container(
                                  width: max,
                                  alignment: Alignment.centerLeft,
                                  child: Row(
                                    children: [
                                      Expanded(
                                        child: Text('年龄18周岁（不含）~60周岁（不含）',
                                            maxLines: 1,
                                            overflow: TextOverflow.ellipsis,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color6666,
                                                fontSize: 12.sp)),
                                      ),
                                      Text('＞',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color6666,
                                              fontSize: 12.sp))
                                    ],
                                  ),
                                );
                              })),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '有条件退',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color05b2,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '无需取票',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '已售1.2万+',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '购买须知 ＞',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                        ],
                      ),
                      Positioned(
                          width: 75.w,
                          height: 30.h,
                          right: 0,
                          bottom: 5.h,
                          child: Container(
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(15.w),
                                gradient: LinearGradient(
                                    colors: [
                                      ColorsUtils.rgba(52, 120, 246, 1),
                                      ColorsUtils.rgba(2, 167, 240, 1)
                                    ],
                                    stops: const [
                                      0,
                                      0.99
                                    ],
                                    transform: GradientRotation(
                                        RadianUtils.angleToRadian(90)))),
                            alignment: Alignment.center,
                            child: Text(
                              '立即预定',
                              style:
                                  StylesUtils.customTextStyle(fontSize: 13.sp),
                            ),
                          ))
                    ],
                  ),
                ),
                Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.w),
                      boxShadow: [
                        BoxShadow(
                            color: ColorsUtils.rgba(
                                51, 51, 51, 0.0980392156862745),
                            offset: Offset.zero,
                            blurRadius: 5.w,
                            spreadRadius: 0,
                            blurStyle: BlurStyle.outer)
                      ]),
                  padding:
                      EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
                  margin: EdgeInsets.only(bottom: 15.h),
                  child: Stack(
                    children: [
                      Column(
                        children: [
                          Container(
                            height: 30.h,
                            alignment: Alignment.centerLeft,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Expanded(
                                    child: Text(
                                  '故宫门票(不含内馆)-老人票',
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 16.sp,
                                      color: ColorsUtils.color3333),
                                )),
                                Text.rich(TextSpan(children: [
                                  TextSpan(
                                      text: '￥',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorD900,
                                          fontSize: 13.sp)),
                                  TextSpan(
                                      text: '20',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.colorD900,
                                        fontSize: 24.sp,
                                      ))
                                ]))
                              ],
                            ),
                          ),
                          Container(
                              height: 25.h,
                              alignment: Alignment.centerLeft,
                              child: LayoutBuilder(builder:
                                  (BuildContext context,
                                      BoxConstraints constraints) {
                                double width = ToolsUtils.calculateTextHeight(
                                    context,
                                    '年龄60周岁（含）以上',
                                    FontWeight.normal,
                                    12.sp,
                                    200.w,
                                    1);
                                double max = ToolsUtils.max(
                                    width, constraints.maxWidth - 80.w);
                                return Container(
                                  width: max,
                                  alignment: Alignment.centerLeft,
                                  child: Row(
                                    children: [
                                      Expanded(
                                        child: Text('年龄60周岁（含）以上',
                                            maxLines: 1,
                                            overflow: TextOverflow.ellipsis,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color6666,
                                                fontSize: 12.sp)),
                                      ),
                                      Text('＞',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color6666,
                                              fontSize: 12.sp))
                                    ],
                                  ),
                                );
                              })),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '有条件退',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color05b2,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '无需取票',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '已售1.2万+',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '购买须知 ＞',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                        ],
                      ),
                      Positioned(
                          width: 75.w,
                          height: 30.h,
                          right: 0,
                          bottom: 5.h,
                          child: Container(
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(15.w),
                                gradient: LinearGradient(
                                    colors: [
                                      ColorsUtils.rgba(52, 120, 246, 1),
                                      ColorsUtils.rgba(2, 167, 240, 1)
                                    ],
                                    stops: const [
                                      0,
                                      0.99
                                    ],
                                    transform: GradientRotation(
                                        RadianUtils.angleToRadian(90)))),
                            alignment: Alignment.center,
                            child: Text(
                              '立即预定',
                              style:
                                  StylesUtils.customTextStyle(fontSize: 13.sp),
                            ),
                          ))
                    ],
                  ),
                ),
                Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.w),
                      boxShadow: [
                        BoxShadow(
                            color: ColorsUtils.rgba(
                                51, 51, 51, 0.0980392156862745),
                            offset: Offset.zero,
                            blurRadius: 5.w,
                            spreadRadius: 0,
                            blurStyle: BlurStyle.outer)
                      ]),
                  padding:
                      EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
                  margin: EdgeInsets.only(bottom: 15.h),
                  child: Stack(
                    children: [
                      Column(
                        children: [
                          Container(
                            height: 30.h,
                            alignment: Alignment.centerLeft,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Expanded(
                                    child: Text(
                                  '故宫门票(不含内馆)-学生票',
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: StylesUtils.customTextStyle(
                                      fontSize: 16.sp,
                                      color: ColorsUtils.color3333),
                                )),
                                Text.rich(TextSpan(children: [
                                  TextSpan(
                                      text: '￥',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.colorD900,
                                          fontSize: 13.sp)),
                                  TextSpan(
                                      text: '20',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.colorD900,
                                        fontSize: 24.sp,
                                      ))
                                ]))
                              ],
                            ),
                          ),
                          Container(
                              height: 25.h,
                              alignment: Alignment.centerLeft,
                              child: LayoutBuilder(builder:
                                  (BuildContext context,
                                      BoxConstraints constraints) {
                                double width = ToolsUtils.calculateTextHeight(
                                    context,
                                    '大学生（含港、澳、台学生；不含成）',
                                    FontWeight.normal,
                                    12.sp,
                                    200.w,
                                    1);
                                double max = ToolsUtils.min(
                                    width, constraints.maxWidth - 80.w);
                                return Container(
                                  width: max,
                                  alignment: Alignment.centerLeft,
                                  child: Row(
                                    children: [
                                      Expanded(
                                        child: Text('大学生（含港、澳、台学生；不含成）',
                                            maxLines: 1,
                                            overflow: TextOverflow.ellipsis,
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color6666,
                                                fontSize: 12.sp)),
                                      ),
                                      Text('＞',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color6666,
                                              fontSize: 12.sp))
                                    ],
                                  ),
                                );
                              })),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '有条件退',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color05b2,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '无需取票',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                          SizedBox(
                            height: 25.h,
                            child: Row(
                              children: [
                                Text(
                                  '已售1.2万+',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.symmetric(horizontal: 5.w),
                                  alignment: Alignment.center,
                                  child: Text(
                                    '|',
                                    style: StylesUtils.customTextStyle(
                                        fontSize: 12.sp,
                                        color: ColorsUtils.colorCccc),
                                  ),
                                ),
                                Text(
                                  '购买须知 ＞',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color6666,
                                      fontSize: 12.sp),
                                )
                              ],
                            ),
                          ),
                        ],
                      ),
                      Positioned(
                          width: 75.w,
                          height: 30.h,
                          right: 0,
                          bottom: 5.h,
                          child: Container(
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(15.w),
                                gradient: LinearGradient(
                                    colors: [
                                      ColorsUtils.rgba(52, 120, 246, 1),
                                      ColorsUtils.rgba(2, 167, 240, 1)
                                    ],
                                    stops: const [
                                      0,
                                      0.99
                                    ],
                                    transform: GradientRotation(
                                        RadianUtils.angleToRadian(90)))),
                            alignment: Alignment.center,
                            child: Text(
                              '立即预定',
                              style:
                                  StylesUtils.customTextStyle(fontSize: 13.sp),
                            ),
                          ))
                    ],
                  ),
                ),
                Container(
                  height: 45.h,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.w),
                      boxShadow: [
                        BoxShadow(
                            color: ColorsUtils.rgba(
                                51, 51, 51, 0.0980392156862745),
                            offset: Offset.zero,
                            blurRadius: 5.w,
                            spreadRadius: 0,
                            blurStyle: BlurStyle.outer)
                      ]),
                  padding:
                      EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        '故宫门票(不含馆内)-未成年票',
                        style: StylesUtils.customTextStyle(
                            fontWeight: FontWeight.w700,
                            color: ColorsUtils.color3333,
                            fontSize: 13.sp),
                      ),
                      Text(
                        '免费预约',
                        style: StylesUtils.customTextStyle(
                            fontSize: 13.sp, color: ColorsUtils.color05b2),
                      )
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            decoration: const BoxDecoration(color: Colors.white),
            padding: EdgeInsets.symmetric(horizontal: 10.w),
            child: Column(
              children: [
                Container(
                  height: 45.h,
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.symmetric(horizontal: 5.w),
                  child: Text(
                    '达人游记',
                    style: StylesUtils.customTextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w700,
                        color: ColorsUtils.color3333),
                  ),
                ),
                StaggeredGrid.count(
                  crossAxisCount: 2,
                  crossAxisSpacing: 10.w,
                  mainAxisSpacing: 5.h,
                  children: controller.data
                      .map((row) => InkWell(
                            onTap: () {
                              Get.toNamed(RoutePath.attractionsArticle,
                                  arguments: {'model': row});
                            },
                            child: Column(
                              children: [
                                Stack(
                                  children: [
                                    ClipPath(
                                      clipper: _MyCliper(),
                                      child: Image.network(row.imgUrl),
                                    ),
                                    if (row.video)
                                      Positioned(
                                        top: 10.w,
                                        right: 10.w,
                                        child: CircleAvatar(
                                          backgroundColor: Colors.black54,
                                          radius: 14.w,
                                          child: Icon(
                                            Icons.videocam_sharp,
                                            color: ColorsUtils
                                                .parseColorFromHexString(
                                                    ColorsUtils.colorFfff),
                                            size: 20.sp,
                                          ),
                                        ),
                                      )
                                  ],
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: EdgeInsets.symmetric(vertical: 8.h),
                                  child: Text(
                                    row.describe,
                                    maxLines: 2,
                                    overflow: TextOverflow.ellipsis,
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333,
                                        fontWeight: FontWeight.w700,
                                        lineHeight: 1.5.h),
                                  ),
                                ),
                                Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.spaceBetween,
                                  children: [
                                    Expanded(
                                        child: Text.rich(
                                      TextSpan(children: [
                                        WidgetSpan(
                                            child: CircleAvatar(
                                          radius: 10,
                                          backgroundImage:
                                              NetworkImage(row.avatar),
                                        )),
                                        TextSpan(
                                            text: '  ${row.nickname}',
                                            style: StylesUtils.customTextStyle(
                                                color: ColorsUtils.color6666,
                                                fontSize: 13.sp))
                                      ]),
                                      maxLines: 1,
                                      overflow: TextOverflow.ellipsis,
                                    )),
                                    Text.rich(TextSpan(children: [
                                      WidgetSpan(
                                          child: Icon(
                                              Icons.remove_red_eye_outlined,
                                              color: ColorsUtils
                                                  .parseColorFromHexString(
                                                      ColorsUtils.color3333),
                                              size: 15.w),
                                          alignment:
                                              PlaceholderAlignment.middle),
                                      TextSpan(
                                          text: '${row.browse}万',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color6666,
                                              fontSize: 13.sp))
                                    ]))
                                  ],
                                )
                              ],
                            ),
                          ))
                      .toList(),
                )
              ],
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            padding: EdgeInsets.symmetric(vertical: 10.h),
            child: Container(
              width: 95.w,
              height: 30.h,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(15.w)),
              child: Text(
                '查看更多＞',
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color6799, fontSize: 13.sp),
              ),
            ),
          ),
        ),
        SliverToBoxAdapter(
          child: Container(
            decoration: const BoxDecoration(
              color: Colors.white,
            ),
            padding: EdgeInsets.all(15.w),
            child: Column(
              children: [
                Container(
                  height: 25.h,
                  alignment: Alignment.centerLeft,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text.rich(TextSpan(children: [
                        TextSpan(
                            text: '用户点评',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333,
                                fontSize: 16.sp,
                                fontWeight: FontWeight.w700)),
                        TextSpan(
                            text: '(487953)',
                            style: StylesUtils.customTextStyle(
                                fontSize: 15.sp,
                                color: ColorsUtils.color3333,
                                fontFamily: StylesUtils.arialFamily))
                      ])),
                      TextButton(
                          onPressed: () {},
                          child: Text(
                            '查看全部＞',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color6799, fontSize: 13.sp),
                          ))
                    ],
                  ),
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  child: Text.rich(TextSpan(children: [
                    TextSpan(
                        text: '4.6',
                        style: StylesUtils.customTextStyle(
                            fontSize: 26.sp,
                            color: ColorsUtils.color3478,
                            fontWeight: FontWeight.w700)),
                    TextSpan(
                        text: '/5分',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color6666, fontSize: 13.sp))
                  ])),
                ),
                Container(
                  padding: EdgeInsets.symmetric(vertical: 10.h),
                  child: MaxLineWrap(
                    spacing: 10.w,
                    runSpacing: 8.w,
                    itemAlignment: MaxLineWrapAlignment.start,
                    children: controller.tags
                        .map((e) =>
                            LayoutBuilder(builder: (context, constraints) {
                              double w = ToolsUtils.calculateTextHeight(
                                  context, e, FontWeight.w400, 12.sp, 100.w, 1);
                              return Container(
                                height: 30.h,
                                width: w + 20.w,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(15.w),
                                    color: ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.colorEaf0)),
                                alignment: Alignment.center,
                                child: Text(
                                  e,
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color3333,
                                      fontSize: 12.sp),
                                ),
                              );
                            }))
                        .toList(),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(bottom: 15.h),
                  child: Column(
                    children: [
                      SizedBox(
                        height: 40.h,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            CircleAvatar(
                              radius: 20.w,
                              backgroundColor: Colors.transparent,
                              backgroundImage: const NetworkImage(
                                'https://img1.baidu.com/it/u=2230340413,2442217261&fm=253&app=53&size=f60,60&n=0&g=0n&f=jpeg&fmt=auto?sec=1706863521&t=c2d07c1ca9bb49ddf5e55884d5ab3de7',
                              ),
                            ),
                            Expanded(
                                child: Column(
                              children: [
                                Container(
                                  height: 20.h,
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    '五行缺钱',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333,
                                        fontSize: 15.sp),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: EdgeInsets.only(top: 5.h),
                                  child: Text(
                                    '2023-11-25  来自北京',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999,
                                        fontSize: 12.sp),
                                  ),
                                )
                              ],
                            )),
                            Align(
                              alignment: Alignment.topRight,
                              child: ToolsUtils.assetImageSvg('u791.svg',
                                  width: 16.sp, height: 16.sp),
                            )
                          ],
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.symmetric(vertical: 10.h),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '去故宫建议和贴士： 避开周末，人会少很多 故宫餐厅就餐会排队，建议早点去 如果第一次去，走中轴线游览 如果第二次去，游览故宫东侧延禧宫珍宝',
                          maxLines: 3,
                          overflow: TextOverflow.ellipsis,
                          style: StylesUtils.customTextStyle(
                              fontSize: 15.sp,
                              color: ColorsUtils.color3333,
                              lineHeight: 1.5.h),
                        ),
                      ),
                      StaggeredGrid.count(
                        crossAxisCount: 3,
                        crossAxisSpacing: 8.w,
                        mainAxisSpacing: 8.w,
                        children: [
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img1.baidu.com/it/u=4122970627,3800550945&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img1.baidu.com/it/u=2488364572,2759096292&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img0.baidu.com/it/u=3010233418,2224126101&fm=253&fmt=auto&app=138&f=JPEG?w=499&h=281',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img0.baidu.com/it/u=3368221683,1026380209&fm=253&fmt=auto&app=120&f=JPEG?w=667&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img2.baidu.com/it/u=2619871711,1635215366&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                        ],
                      )
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(bottom: 15.h),
                  child: Column(
                    children: [
                      SizedBox(
                        height: 40.h,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            CircleAvatar(
                              radius: 20.w,
                              backgroundColor: Colors.transparent,
                              backgroundImage: const NetworkImage(
                                'https://img0.baidu.com/it/u=2947341353,265385944&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1704387600&t=86d9882d1eb9832c3b3e92c518cf95cf',
                              ),
                            ),
                            Expanded(
                                child: Column(
                              children: [
                                Container(
                                  height: 20.h,
                                  alignment: Alignment.centerLeft,
                                  child: Text(
                                    'M****0',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333,
                                        fontSize: 15.sp),
                                  ),
                                ),
                                Container(
                                  alignment: Alignment.centerLeft,
                                  margin: EdgeInsets.only(top: 5.h),
                                  child: Text(
                                    '2023-10-25  来自广东',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999,
                                        fontSize: 12.sp),
                                  ),
                                )
                              ],
                            )),
                            Align(
                                alignment: Alignment.topRight,
                                child: Text.rich(TextSpan(children: [
                                  WidgetSpan(
                                      child: ToolsUtils.assetImageSvg(
                                          'u791.svg',
                                          width: 16.sp,
                                          height: 16.sp),
                                      alignment: PlaceholderAlignment.middle),
                                  TextSpan(
                                      text: '32',
                                      style: StylesUtils.customTextStyle(
                                          color: ColorsUtils.color6666,
                                          fontSize: 12.sp))
                                ])))
                          ],
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.symmetric(vertical: 10.h),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '去故宫建议和贴士： 避开周末，人会少很多 故宫餐厅就餐会排队，建议早点去 如果第一次去，走中轴线游览 如果第二次去，游览故宫东侧延禧宫珍宝',
                          maxLines: 3,
                          overflow: TextOverflow.ellipsis,
                          style: StylesUtils.customTextStyle(
                              fontSize: 15.sp,
                              color: ColorsUtils.color3333,
                              lineHeight: 1.5.h),
                        ),
                      ),
                      StaggeredGrid.count(
                        crossAxisCount: 3,
                        crossAxisSpacing: 8.w,
                        mainAxisSpacing: 8.w,
                        children: [
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img1.baidu.com/it/u=4122970627,3800550945&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img1.baidu.com/it/u=2488364572,2759096292&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img0.baidu.com/it/u=3010233418,2224126101&fm=253&fmt=auto&app=138&f=JPEG?w=499&h=281',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img0.baidu.com/it/u=3368221683,1026380209&fm=253&fmt=auto&app=120&f=JPEG?w=667&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(8.w),
                            child: CachedNetworkImage(
                              imageUrl:
                                  'https://img2.baidu.com/it/u=2619871711,1635215366&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500',
                              alignment: Alignment.topLeft,
                              fit: BoxFit.cover,
                              height: 110.h,
                              placeholder: (context, url) =>
                                  const CircularProgressIndicator(),
                            ),
                          ),
                        ],
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
        )
      ],
    );
  }

  Future<void> _showBasicModalBottomSheet(BuildContext context) async {
    return showModalBottomSheet<void>(
      isScrollControlled: false,
      backgroundColor: Colors.transparent,
      context: context,
      useSafeArea: true,
      builder: (BuildContext context) {
        return Container(
          height: Get.size.height * 0.8,
          decoration: const BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(10.0),
              topRight: Radius.circular(10.0),
            ),
          ),
          clipBehavior: Clip.antiAlias,
          child: Column(
            children: [
              Container(
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(10.w),
                        topRight: Radius.circular(10.w))),
                height: 50.h,
                child: Stack(
                  children: [
                    Center(
                      child: Text(
                        '园区公告',
                        style: StylesUtils.customTextStyle(
                            fontSize: 18.sp, color: ColorsUtils.color0000),
                      ),
                    ),
                    Positioned(
                      top: 0,
                      right: 0,
                      width: 50.w,
                      height: 50.w,
                      child: Center(
                        child: IconButton(
                            onPressed: () {
                              Navigator.of(context).pop();
                            },
                            icon: Icon(
                              Icons.close,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color3333),
                              size: 15.sp,
                            )),
                      ),
                    )
                  ],
                ),
              ),
              Expanded(
                  child: SingleChildScrollView(
                child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 10.w),
                  decoration: const BoxDecoration(color: Colors.white),
                  child: Column(
                    children: [
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '出行公告',
                          style: StylesUtils.customTextStyle(
                              fontSize: 16.sp, color: ColorsUtils.color3333),
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(vertical: 15.w),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '北京市内游重要信息提醒',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333,
                              fontWeight: FontWeight.w700),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '北京近日发布重要疫情防控措施提醒:“进返京人员抵京后7天内不聚餐、不聚会、不前往人群密集场所”，进入文旅场所(室内场所)时须满足“7天内无京外旅居史”。所有出京旅行及自驾游人员返京要主动报备，进返京后开展3天2检。请您密切关注，其他常态化疫情防控措施具体如下：',
                          style: StylesUtils.customTextStyle(
                              lineHeight: 1.5.h, color: ColorsUtils.color3333),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding: EdgeInsets.symmetric(vertical: 15.w),
                        child: Text(
                          '1、北京市暂不恢复进出京跨省团队旅游及“机票+酒店”业务，继续暂停出入境团队旅游及“机票+酒店”业务。北京市内团队游等旅游活动旅行社和在线旅游平台可以开展但不接受京外游客报名，参加团队旅游人员（含游客、导游、司机、随团其他工作人员等全口径参团人员）应完成新冠疫苗全程接种或加强免疫接种（全程接种六个月以上的，应提供加强免疫接种证明）。其中：不满3周岁的未成年人参团可不提供新冠疫苗接种证明；3周岁以上不满18周岁的未成年人参团应提供新冠疫苗全程接种证明，不必提供加强免疫接种证明；18周岁以上的成年人参团应完成新冠疫苗全程接种或加强免疫接种（全程接种六个月以上的，应提供加强免疫接种证明），不适宜接种人员可凭北京“健康宝”中禁忌筛查判定证明（显示不适宜接种）参团。（温馨提示：据悉，北京各疫苗接种点已开展禁忌筛查判定工作，详情可询疫苗接种点或疾控部门。）',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '2、除跟团游玩外采取其他方式在北京游玩的，请注意：市民群众在严格测温扫码和查验48小时内核酸检测阴性证明后即可正常进入市内各类公共场所。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding: EdgeInsets.symmetric(vertical: 15.w),
                        child: Text(
                          '3、7天内有1例及以上本土新冠病毒感染者所在县（市、区、旗，下同）旅居史人员严格限制进返京。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '4、根据当前国内疫情形势，继续执行远端筛查措施，除严格限制进返京人员外有进返京计划的旅客，持48小时内核酸检测阴性证明、“北京健康宝”绿码，在测温正常且做好个人防护的前提下可正常进返京，抵京24小时后、72小时内进行1次核酸检测。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding: EdgeInsets.symmetric(vertical: 15.w),
                        child: Text(
                          '上述重要信息请您务必留意，并同时密切关注我们发布的《关于疫情常态化下出行重要信息提醒》严格遵照执行，感谢您的理解与配合，谢谢。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '疫情期间出行必读',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333,
                              fontWeight: FontWeight.w700),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        padding: EdgeInsets.symmetric(vertical: 15.w),
                        child: Text(
                          '1、故宫博物院按照75%限流要求恢复开放。入院观众须持有48小时核酸检测阴性证明，配合测温和健康宝查验。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                      Container(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '2、根据北京市防疫政策“进返京人员抵京后7天内不聚餐，不聚会，不前往人员密集场所”，无京外7天以内旅居史，无高风险地区7天以内旅居史的游客方可购票入院。',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color3333, lineHeight: 1.5.h),
                        ),
                      ),
                    ],
                  ),
                ),
              ))
            ],
          ),
        );
      },
    );
  }

  String get weekDay {
    Map<int, String> map = <int, String>{
      1: '周一',
      2: '周二',
      3: '周三',
      4: '周四',
      5: '周五',
      6: '周六',
      7: '周日'
    };
    return map[DateTime.now().weekday] ?? '周日';
  }
}

class _SliverCustomHeaderDelegate extends SliverPersistentHeaderDelegate {
  final double collapsedHeight;
  final double expandedHeight;
  final double paddingTop;
  final String coverImgUrl;
  final String title;
  int level;
  String statusBarMode = 'light';

  _SliverCustomHeaderDelegate(
      {required this.collapsedHeight,
      required this.expandedHeight,
      required this.paddingTop,
      required this.coverImgUrl,
      required this.title,
      this.level = 5});

  @override
  double get minExtent => collapsedHeight + paddingTop;

  @override
  double get maxExtent => expandedHeight;

  @override
  bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
    return true;
  }

  void updateStatusBarBrightness(shrinkOffset) {
    if (shrinkOffset > 50) {
      SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
        statusBarBrightness: Brightness.dark,
        statusBarIconBrightness: Brightness.dark,
      ));
    } else {
      SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
        statusBarBrightness: Brightness.light,
        statusBarIconBrightness: Brightness.light,
      ));
    }
  }

  Color makeStickyHeaderBgColor(shrinkOffset) {
    final int alpha =
        (shrinkOffset / (maxExtent - minExtent) * 255).clamp(0, 255).toInt();
    return Color.fromARGB(alpha, 255, 255, 255);
  }

  Color makeStickyHeaderTextColor(shrinkOffset, isIcon) {
    if (shrinkOffset <= 30) {
      return isIcon ? Colors.white : Colors.transparent;
    } else {
      final int alpha =
          (shrinkOffset / (maxExtent - minExtent) * 255).clamp(0, 255).toInt();
      return Color.fromARGB(alpha, 0, 0, 0);
    }
  }

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    updateStatusBarBrightness(shrinkOffset);
    return SizedBox(
      height: maxExtent,
      child: Stack(
        fit: StackFit.expand,
        children: <Widget>[
          Container(
            alignment: Alignment.bottomCenter,
            decoration: BoxDecoration(
                image: DecorationImage(
                    image: NetworkImage(coverImgUrl), fit: BoxFit.cover)),
            child: Container(
              width: double.infinity,
              padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(15.w),
                      topRight: Radius.circular(15.w))),
              child: Wrap(
                spacing: 5.w,
                crossAxisAlignment: WrapCrossAlignment.center,
                children: [
                  Text(
                    title,
                    style: StylesUtils.customTextStyle(
                        fontWeight: FontWeight.w700,
                        fontSize: 22.sp,
                        color: ColorsUtils.color3333),
                  ),
                  Container(
                    width: 24.w,
                    height: 18.h,
                    decoration: BoxDecoration(
                        color: ColorsUtils.parseColorFromHexString(
                            ColorsUtils.colorF2f2),
                        borderRadius: BorderRadius.circular(3.w)),
                    alignment: Alignment.center,
                    child: Text(
                      '${level}A',
                      style: StylesUtils.customTextStyle(
                          fontSize: 12.sp, color: ColorsUtils.color6666),
                    ),
                  )
                ],
              ),
            ),
          ),
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            child: Container(
              color: makeStickyHeaderBgColor(shrinkOffset),
              child: SafeArea(
                bottom: false,
                child: SizedBox(
                  height: collapsedHeight,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      IconButton(
                        icon: Icon(
                          Icons.arrow_back_ios,
                          color: makeStickyHeaderTextColor(shrinkOffset, true),
                        ),
                        onPressed: () => Get.back(),
                      ),
                      Expanded(
                          child: Center(
                              child: Text(
                        title,
                        style: TextStyle(
                          fontSize: 18.sp,
                          fontWeight: FontWeight.w500,
                          color: makeStickyHeaderTextColor(shrinkOffset, false),
                        ),
                      ))),
                      IconButton(
                        icon: Icon(
                          Icons.share,
                          color: makeStickyHeaderTextColor(shrinkOffset, true),
                        ),
                        onPressed: () async {
                          // int? index = await ToolsUtils.openShare(context);
                        },
                      ),
                    ],
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class _MyCustomPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Paint paint = Paint()
      ..style = PaintingStyle.stroke
      ..strokeWidth = 2
      ..color = ColorsUtils.parseColorFromHexString(ColorsUtils.color3478);
    double dx = size.width / 2;
    double dy = (size.height - 13) / 2;
    canvas.drawLine(Offset(dx, dy), Offset(dx, dy + 13), paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return this != oldDelegate;
  }
}

class _MyCliper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    Path path = Path();
    path.addRRect(RRect.fromLTRBAndCorners(0, 0, size.width, size.height,
        topLeft: Radius.circular(8.w), topRight: Radius.circular(8.w)));
    return path;
  }

  @override
  bool shouldReclip(covariant CustomClipper oldClipper) {
    return this != oldClipper;
  }
}
